$(document).ready(function(){
	var current = 0;
	var len = 2;
	var time;
	$('#stageindex').find('li').eq(0).addClass('current');
	$('#stagepic').find('li').eq(0).show();
	$('#stagemsg').find('li').eq(0).show();
	
	toggle = function(index){
		$('#stageindex').find('li').eq(index).addClass('current').siblings().removeClass('current');
		$('#stagepic').find('li').eq(index).animate({opacity:'show'},100).siblings().animate({opacity:'hide'},100);
		$('#stagemsg').find('li').eq(index).animate({opacity:'show'},100).siblings().animate({opacity:'hide'},0);
	}
	toggleslow = function(index){
		$('#stageindex').find('li').eq(index).addClass('current').siblings().removeClass('current');
		$('#stagepic').find('li').eq(index).animate({opacity:'show'},600).siblings().animate({opacity:'hide'},600);
		$('#stagemsg').find('li').eq(index).animate({opacity:'show'},600).siblings().animate({opacity:'hide'},0);
	}
	
	$('#stageindex').find('li').hover(function(){
		clearInterval(time);
		current = $(this).index();
		toggle(current);
	},function(){
		time = setInterval(function(){
			current++;
			if(current==3)current=0;
			toggleslow(current);
		},3000);
	});
	
	$('#stagepic').hover(function(){
		clearInterval(time);
	},function(){
		time = setInterval(function(){
			current++;
			if(current==3)current=0;
			toggleslow(current);
		},3000);
	}).trigger('mouseleave');
	
	
});